package com.msmall.community.wish.model;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.msmall.base.model.BaseObject;

@Entity
@Table(name = "wish")
public class Wish extends BaseObject {

	private static final long serialVersionUID = 3889136228014955913L;

	@Id
	@Column(name = "wishid", insertable = false, updatable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long wishid;
	
	@Column(name = "userid")
	private Long userid;
	
	/**
	 * 心愿内容
	 */
	@Column(name = "content")
	private String content;
	
	/**
	 * 心愿内容形成的TIPS，subString(0,10)
	 */
	@Column(name = "tips")
	private String tips;
	
	/**
	 * 此心愿专用图片地址
	 */
	@Column(name = "image")
	private String image;
	
	/**
	 * 是否允许回复 ConstantDB.REPLY UNREPLY
	 */
	@Column(name = "reply")
	private Short reply;
	
	/**
	 *  ConstantDB.AVALIABLEY UNAVALIABLEY
	 */
	@Column(name = "enabled")
	private Short enabled;
	
	@Column(name="create_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;
	
	/**
	 * 心愿类型
	 */
	@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY)
	@JoinColumn(name="typeid")
	private WishType type;
	
	@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY, mappedBy="wish")
	private Set<WishReply> replies;
	
	public Long getWishid() {
		return wishid;
	}

	public void setWishid(Long wishid) {
		this.wishid = wishid;
	}

	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getTips() {
		return tips;
	}

	public void setTips(String tips) {
		this.tips = tips;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public Short getReply() {
		return reply;
	}

	public void setReply(Short reply) {
		this.reply = reply;
	}

	public Short getEnabled() {
		return enabled;
	}

	public void setEnabled(Short enabled) {
		this.enabled = enabled;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public WishType getType() {
		return type;
	}

	public void setType(WishType type) {
		this.type = type;
	}

	public Set<WishReply> getReplies() {
		return replies;
	}

	public void setReplies(Set<WishReply> replies) {
		this.replies = replies;
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

}
